package UI;

import java.io.Serializable;
import java.util.Comparator;
import java.util.Date;

public class StatusUI implements Serializable{
    
    private String update;
    private Date timeupdated;
    private int updater_id;
    private String updater;

    public StatusUI() {
    }

    public StatusUI(String update, Date timeUpdated){
        this.update = update;
        this.timeupdated = timeUpdated;
    }
    
    public StatusUI(String update, Date timeupdated, int updater_id, String updater) {
        this.update = update;
        this.timeupdated = timeupdated;
        this.updater_id = updater_id;
        this.updater = updater;
    }

    public Date getTimeupdated() {
        return timeupdated;
    }

    public void setTimeupdated(Date timeupdated) {
        this.timeupdated = timeupdated;
    }

    public String getUpdate() {
        return update;
    }

    public void setUpdate(String update) {
        this.update = update;
    }

    public String getUpdater() {
        return updater;
    }

    public void setUpdater(String updater) {
        this.updater = updater;
    }

    public int getUpdater_id() {
        return updater_id;
    }

    public void setUpdater_id(int updater_id) {
        this.updater_id = updater_id;
    }
    
    public String getModifiedDateString(){
        String month = null;
        String hour = null;
        String day = null;
        String minute = null;
        int monthint = timeupdated.getMonth() + 1;
        int yearint = timeupdated.getYear() + 1900;
        if (monthint < 10) {
            month = "0" + monthint;
        } else {
            month = "" + monthint;
        }

        if (timeupdated.getDate() < 10) {
            day = "0" + timeupdated.getDate();
        } else {
            day = "" + timeupdated.getDate();
        }


        if (timeupdated.getHours() < 10) {
            hour = "0" + timeupdated.getHours();
        } else {
            hour = "" + timeupdated.getHours();
        }
        
        if (timeupdated.getMinutes() < 10) {
            minute = "0" + timeupdated.getMinutes();
        } else {
            minute = "" + timeupdated.getMinutes();
        }

        String string = new String("" + yearint + "-" + month +"-" + day + " " + hour + ":" + minute);

        return string;
    }
    
    
}
